package sort.record;

import java.io.Serializable;

/**
 * @author masaru-gotou
 *
 */
@SuppressWarnings("serial")
public class Record implements Serializable {
	private int key;
	private String value;
	/**
	 * 
	 */
	public Record() {
	}
	/**
	 * @param key
	 * @param value
	 */
	public Record(int key, String value) {
		this.key = key;
		this.value = value;
	}
	public Record(Record record) {
		this(record.key,record.value);
	}
	/**
	 * @return key
	 */
	public final int getKey() {
		return key;
	}
	/**
	 * @param key
	 */
	public final void setKey(int key) {
		this.key = key;
	}
	/**
	 * @return value
	 */
	public final String getValue() {
		return value;
	}
	/**
	 * @param value
	 */
	public final void setValue(String value) {
		this.value = value;
	}
	/*
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "key="+key+","+"value="+value;
	}
	/* 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + key;
		result = PRIME * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}
	/* 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Record other = (Record) obj;
		if (key != other.key)
			return false;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}
}
